<!DOCTYPE html>
<#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
<#assign SourceDept = JspTaglibs["http://www.casic304.cn/SourceDept"]/>
<#assign f = JspTaglibs["http://www.casic304.cn/f"] />
<html>
<head>
    <meta charset="utf-8">
    <title>质量成本信息列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>
<body class="listBody">
<div class="qbdms-list">
    <div class="layui-table-view-body">
    <table id="wQbdQualityCostTable" lay-filter="wQbdQualityCostTable"></table>
    </div>
</div>
<!-- 列表头部工具栏 -->
<script type="text/html" id="wQbdQualityCostHeaderToolsBar">
    <div class="ccpui-enterSel">
        <div class="layui-btn-container">
        <@f.a alias="zlcbgl_xzan2" event="add" css="layui-btn layui-btn-sm fillBtn" >
            <span>新增</span>
        </@f.a>
        <@f.a alias="zlcbgl_scan2" event="delete" css="layui-btn layui-btn-sm" >
            <span>删除</span>
        </@f.a>
        <@f.a alias="zlcbgl_dcan1,zlcbgl_dcan2" event="export" css="layui-btn layui-btn-sm" >
            <span>导出</span>
        </@f.a>
        <@f.a alias="zlcbgl_dran2" event="import" css="layui-btn layui-btn-sm" >
            <span>导入</span>
        </@f.a>
        <@f.a alias="zlcbgl_sban2" event="report" css="layui-btn layui-btn-sm" >
            <span>上报</span>
        </@f.a>
        </div>
        <form class="layui-form" action="" lay-filter="wQbdQualityCostQueryForm">
            <div class="layui-form-body selch">
                <div class="table-top-filter layui-row">
                    <@SourceDept.dept css="layui-input filter-value"/>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">年度</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value dateTimeFiled time-init year" name="Q_beginYear_S" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">统计期</label>
                        <div class="layui-input-block">
                            <@dicSelect.dic name="Q_statisticalPeriod_SL" css="layui-input filter-value" nodeKey="tjq" activity=true />
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">型号类别</label>
                        <div class="layui-input-block">
                            <@dicSelect.dic name="Q_modelType_SL" css="layui-input filter-value" nodeKey="xhlb" activity=true />
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                            <label class="layui-form-label">型号名称</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_modelName_SL" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">型号代号</label>
                        <div class="layui-input-block">
                            <select class="layui-input filter-value" name="Q_modelCode_SL">
                                <option></option>
                            </select>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">填写开始日期</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value start_time time-init" name="Q_beginFilldate_S" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">填写结束日期</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value end_time time-init" name="Q_endFilldate_S" placeholder="请输入" />
                        </div>
                    </div>
                </div>
                <div class="selchBtn">
                    <a class="layui-btn layui-btn-sm fillBtn" lay-event="query">
                        <span>查询</span>
                    </a>
                    <div class="layui-btn-group">
                        <button type="button" class="layui-btn layui-btn-sm" lay-event="clears" style="width: 28px;font-size: 12px;padding: 0">
                            <i class="iconfont data-iconcommon_refresh"></i>
                        </button>
                        <button type="button" class="layui-btn layui-btn-sm screenParent" lay-event="screen" style="width: 28px;font-size: 12px;padding: 0">
                            <i class="iconfont data-iconcommon_downarrow screen"></i>
                        </button>
                    </div>
                </div>
            </div>
        </form>
    </div>

</script>
<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdQualityCostRightToolsBar">

    {{# if('${currentUserId}'==d.createBy && d.allowEdit ){}}
    <@f.a alias="zlcbgl_bjan2" event="edit" css="RightBtn">编辑</@f.a>
    {{#  } }}

    <@f.a alias="zlcbgl_mxan1,zlcbgl_mxan2" event="particulars" css="RightBtn">详情</@f.a>

    {{# if('${currentUserId}'==d.createBy && d.allowDel ){}}
    <@f.a alias="zlcbgl_scan2" event="del" css="RightBtn">删除</@f.a>
    {{#  } }}

</script>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','table', 'form', 'common','publicMethods','jquery','layer','laydate'], function () {
        var table = layui.table;
        var form = layui.form;
        var common = layui.common;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;
        var laydate = layui.laydate;
        common.tableSort('wQbdQualityCostTable');

        var tableH=publicMethods.tabHeight();

        var currentSystemLevel = "${currentSystemLevel}";

        var commonCols = [ //表头
            {type: 'checkbox', fixed: 'left'}
            ,{field: 'sn', type: 'numbers', title: '序号', fixed: 'left',minWidth:'90'}
            ,{field: 'id', title: '主键id',hide:true,sort:false, sortname: 'id'}
            ,{field: 'filldate', title: '填写日期',width: 110,sort:false, sortname: 'filldate',minWidth:'140'}
            ,{field: 'companyName', title: '单位名称',hide:true,sort:false, sortname: 'company_name',minWidth:'140'}
            ,{field: 'secret', title: '密级',hide:true,sort:false, sortname: 'secret',minWidth:'140'}
            //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.year,"1");
            //如需转换为HH:mm:ss: return publicMethods.timeData(d.year,"2");
            // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.year);
            ,{field: 'year', title: '年度',sort:false,width: 80, sortname: 'year',minWidth:'140',templet: function (d) {
                return publicMethods.timeData(d.year,"3");
            }}
            ,{field: 'statisticalPeriod', title: '统计期',width: 90,sort:false, sortname: 'statistical_period',minWidth:'140'}
            ,{field: 'modelName', title: '型号名称',width: 110,sort:false, sortname: 'model_name',minWidth:'140'}
            ,{field: 'modelCode', title: '型号代号',width: 110,sort:false, sortname: 'model_code',minWidth:'140'}
            ,{field: 'modelType', title: '型号类别',width: 110,sort:false, sortname: 'model_type',minWidth:'140'}
            ,{field: 'preventionCost', title: '预防成本(万元)',align:'right',sort:false, sortname: 'prevention_cost',minWidth:'150',templet: function (d) {
                if (d.preventionCost != null){
                    return '<span style="color: #F07878">'+d.preventionCost+'</span>';
                }else {
                    return '<span style="color: #F07878">'+0+'</span>';
                }
            } }
            ,{field: 'qualityOperatingExpenses', title: '质量工作费(万元)',hide:true,sort:false, sortname: 'quality_operating_expenses'}
            ,{field: 'qualityEdducationTrainFee', title: '质量教育培训费(万元)',hide:true,sort:false, sortname: 'quality_edducation_train_fee'}
            ,{field: 'qualityReviewFee', title: '质量评审费(万元)',hide:true,sort:false, sortname: 'quality_review_fee'}
            ,{field: 'qualityIncentiveFee', title: '质量奖励费(万元)',hide:true,sort:false, sortname: 'quality_incentive_fee'}
            ,{field: 'qualityInprovementMeasure', title: '质量改进措施费(万元)',hide:true,sort:false, sortname: 'quality_inprovement_measure'}
            ,{field: 'qualityManagementPersonnel', title: '质量管理人员薪酬(万元)',hide:true,sort:false, sortname: 'quality_management_personnel'}
            ,{field: 'appraisalCosts', title: '鉴定成本(万元)',align: 'right',sort:false, sortname: 'appraisal_costs',minWidth:'150',templet: function (d) {
                if (d.appraisalCosts != null){
                    return '<span style="color: #F07878">'+d.appraisalCosts+'</span>';
                }else {
                    return '<span style="color: #F07878">'+0+'</span>';
                }
            } }
            ,{field: 'inspectionTestOfficeExpense', title: '检验试验办公费(万元)',hide:true,sort:false, sortname: 'inspection_test_office_expense'}
            ,{field: 'equipmentDepreciationCost', title: '检验宿舍被折旧费(万元)',hide:true,sort:false, sortname: 'equipment_depreciation_cost'}
            ,{field: 'inspectionTestFee', title: '检验试验费(万元)',hide:true,sort:false, sortname: 'inspection_test_fee'}
            ,{field: 'salaryAppraisers', title: '鉴定人员薪酬(万元)',hide:true,sort:false, sortname: 'salary_appraisers'}
            ,{field: 'equipmentMaintenance', title: '检验设备维护校对费(万元)',hide:true,sort:false, sortname: 'equipment_maintenance'}
            ,{field: 'appraisalCostOther', title: '鉴定成本其他(万元)',hide:true,sort:false, sortname: 'appraisal_cost_other'}
            ,{field: 'internalFailureCost',align: 'right', title: '内部故障成本(万元)',sort:false, sortname: 'internal_failure_cost',minWidth:'170',templet: function (d) {
                if (d.internalFailureCost != null){
                    return '<span style="color: #F07878">'+d.internalFailureCost+'</span>';
                }else {
                    return '<span style="color: #F07878">'+0+'</span>';
                }
            }}
            ,{field: 'scrapLossExpenses', title: '报废损失费(万元)',hide:true,sort:false, sortname: 'scrap_loss_expenses'}
            ,{field: 'changeDesignLossFee', title: '更改设计损失费(万元)',hide:true,sort:false, sortname: 'change_design_loss_fee'}
            ,{field: 'sparePartsCost', title: '备件损失(万元)',hide:true,sort:false, sortname: 'spare_parts_cost'}
            ,{field: 'accidentAnalysisLoss', title: '事故分析损失费(万元)',hide:true,sort:false, sortname: 'accident_analysis_loss'}
            ,{field: 'reworkRepairLoss', title: '返工返修损失费(万元)',hide:true,sort:false, sortname: 'rework_repair_loss'}
            ,{field: 'productDegradationLossFee', title: '产品降级损失费(万元)',hide:true,sort:false, sortname: 'product_degradation_loss_fee'}
            ,{field: 'stopLoss', title: '停工损失(万元)',hide:true,sort:true, sortname: 'stop_loss'}
            ,{field: 'testLoss', title: '试验损失费(万元)',hide:true,sort:true, sortname: 'test_loss'}
            ,{field: 'internalFailureCostOther', title: '内部故障成本其他(万元)',hide:true,sort:false, sortname: 'internal_failure_cost_other',minWidth:'190'}
            ,{field: 'externalFailureCost',align: 'right', title: '外部故障成本(万元)',sort:false, sortname: 'external_failure_cost',minWidth:'170',templet: function (d) {
                if (d.externalFailureCost != null){
                    return '<span style="color: #F07878">'+d.externalFailureCost+'</span>';
                }else {
                    return '<span style="color: #F07878">'+0+'</span>';
                }
            }}
            ,{field: 'claimForLoss', title: '索赔损失费(万元)',hide:true,sort:false, sortname: 'claim_for_loss'}
            ,{field: 'productPriceReductionLoss', title: '产品降价损失费(万元)',hide:true,sort:false, sortname: 'product_price_reduction_loss'}
            ,{field: 'lossOnReturns', title: '退货损失费(万元)',hide:true,sort:false, sortname: 'loss_on_returns'}
            ,{field: 'legalFees', title: '诉讼费(万元)',hide:true,sort:true, sortname: 'legal_fees'}
            ,{field: 'maintenanceFee', title: '保修费(万元)',hide:true,sort:true, sortname: 'maintenance_fee'}
            ,{field: 'externalFailureCostOther', title: '外部故障成本其他(万元)',hide:true,sort:true, sortname: 'external_failure_cost_other'}
            ,{field: 'externalFailureCostA', title: '外部故障成本(A)(万元)',hide:true,sort:true, sortname: 'external_failure_cost_a'}
            ,{field: 'claimForLossA', title: '索赔损失费(A)(万元)',hide:true,sort:true, sortname: 'claim_for_loss_a'}
            ,{field: 'productPriceReductionLossA', title: '产品降价损失费(A)(万元)',hide:true,sort:true, sortname: 'product_price_reduction_loss_a'}
            ,{field: 'lossOnReturnsA', title: '退货损失费(A)(万元)',hide:true,sort:true, sortname: 'loss_on_returns_a'}
            ,{field: 'legalFeesA', title: '诉讼费(A)(万元)',hide:true,sort:true, sortname: 'legal_fees_a'}
            ,{field: 'maintenanceFeeA', title: '保修费(A)(万元)',hide:true,sort:true, sortname: 'maintenance_fee_a'}
            ,{field: 'externalFailureCostOtherA', title: '外部故障成本其他(A)(万元)',hide:true,sort:true, sortname: 'external_failure_cost_other_a'}
            ,{field: 'externalFailureCostB', title: '外部故障成本(B)(万元)',hide:true,sort:true, sortname: 'external_failure_cost_b'}
            ,{field: 'claimForLossB', title: '索赔损失费(B)(万元)',hide:true,sort:true, sortname: 'claim_for_loss_b'}
            ,{field: 'productPriceReductionLossB', title: '产品降价损失费(B)(万元)',hide:true,sort:true, sortname: 'product_price_reduction_loss_b'}
            ,{field: 'lossOnReturnsB', title: '退货损失费(B)(万元)',hide:true,sort:true, sortname: 'loss_on_returns_b'}
            ,{field: 'legalFeesB', title: '诉讼费(B)(万元)',hide:true,sort:true, sortname: 'legal_fees_b'}
            ,{field: 'maintenanceFeeB', title: '保修费(B)(万元)',hide:true,sort:true, sortname: 'maintenance_fee_b'}
            ,{field: 'externalFailureCostOtherB', title: '外部故障成本其他(B)(万元)',hide:true,sort:true, sortname: 'external_failure_cost_other_b'}
            ,{field: 'externalFailureCostC', title: '外部故障成本(C)(万元)',hide:true,sort:true, sortname: 'external_failure_cost_c'}
            ,{field: 'claimForLossC', title: '索赔损失费(C)(万元)',hide:true,sort:true, sortname: 'claim_for_loss_c'}
            ,{field: 'productPriceReductionLossC', title: '产品降价损失费(C)(万元)',hide:true,sort:true, sortname: 'product_price_reduction_loss_c'}
            ,{field: 'lossOnReturnsC', title: '退货损失费(C)(万元)',hide:true,sort:true, sortname: 'loss_on_returns_c'}
            ,{field: 'legalFeesC', title: '诉讼费(C)(万元)',hide:true,sort:true, sortname: 'legal_fees_c'}
            ,{field: 'maintenanceFeeC', title: '保修费(C)(万元)',hide:true,sort:true, sortname: 'maintenance_fee_c'}
            ,{field: 'externalFailureCostOtherC', title: '外部故障成本其他(C)(万元)',hide:true,sort:true, sortname: 'external_failure_cost_other_c'}
            ,{field: 'totalMilitaryRevenue', title: '军品营业总收入（财务快报数）(万元)',hide:true,sort:true, sortname: 'total_military_revenue'}
            ,{field: 'totalMilitaryOperatingCost', title: '军品营业总成本（财务快报数）(万元)',hide:true,sort:true, sortname: 'total_military_operating_cost'}
            ,{field: 'fillman', title: '填写人',hide:true,sort:true, sortname: 'fillman'}
            //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.filldate,"1");
            //如需转换为HH:mm:ss: return publicMethods.timeData(d.filldate,"2");
            // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.filldate);
            ,{field: 'filldate', title: '填写日期',hide:true,sort:true, sortname: 'filldate',templet: function (d) {
                return publicMethods.timeData(d.filldate);
            }}
            ,{field: 'fillmanaccount', title: '填写人账号',hide:true,sort:true, sortname: 'fillmanaccount'}
            ,{field: 'filldept', title: '填写部门',hide:true,sort:true, sortname: 'filldept'}
            ,{field: 'filldeptid', title: '填写部门编码',hide:true,sort:true, sortname: 'filldeptid'}
            ,{field: 'tenantId', title: '租户Id',hide:true,sort:true, sortname: 'tenantid'}
            ,{field: 'createBy', title: '创建人',hide:true,sort:true, sortname: 'createby'}
            //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.createTime,"1");
            //如需转换为HH:mm:ss: return publicMethods.timeData(d.createTime,"2");
            // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.createTime);
            ,{field: 'createTime', title: '创建时间',hide:true,sort:true, sortname: 'createtime',templet: function (d) {
                return publicMethods.timeData(d.createTime);
            }}
            ,{field: 'updateBy', title: '更新人',hide:true,sort:true, sortname: 'updateby'}
            //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.updateTime,"1");
            //如需转换为HH:mm:ss: return publicMethods.timeData(d.updateTime,"2");
            // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.updateTime);
            ,{field: 'updateTime', title: '更新时间',hide:true,sort:true, sortname: 'updatetime',templet: function (d) {
                return publicMethods.timeData(d.updateTime);
            }}
            ,{field: 'belongdeptname', title: '所属单位',hide:true,sort:true, sortname: 'belongdeptname'}
            ,{field: 'returnmsg', title: '错误消息',hide:true,sort:true, sortname: 'returnmsg'}
            ,{field: 'filldepthospital', title: '填写部门院',hide:true,sort:true, sortname: 'filldepthospital'}
            ,{field: 'filldepthospitalid', title: '填写部门院编码',hide:true,sort:true, sortname: 'filldepthospitalid'}
            //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.reportDate,"1");
            //如需转换为HH:mm:ss: return publicMethods.timeData(d.reportDate,"2");
            // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.reportDate);
            ,{field: 'reportDate', title: '上报日期',hide:true,sort:true, sortname: 'report_date',templet: function (d) {
                return publicMethods.timeData(d.reportDate);
            }}
            ,{field: 'reportReason', title: '中间件操作失败原因',hide:true,sort:true, sortname: 'report_reason'}
        ];

        var manageCols = {
            fixed: 'right',
            minWidth: 70,
            title: '管理',
            toolbar: '#wQbdQualityCostRightToolsBar'
        };

        var diyCols = [];
        if("GROUPLEVEL" !== currentSystemLevel){
            diyCols = [{field: 'reportStatusStr', title: '上报状态',width: 125,sort:false, sortname: 'report_status',minWidth:'180',templet: function (d) {
                return common.stateType(d);
            }}];
        }

        var totalCols = [];
        totalCols = totalCols.concat(commonCols).concat(diyCols).concat(manageCols);

        //第一个实例
        table.render({
            elem: '#wQbdQualityCostTable'
            ,height:tableH
            ,url: '${ctx}/qbdms/wQbdQualityCost/list'
            ,page: publicMethods.pageFun()
            ,limit: 20
            ,defaultToolbar: ['']
            ,toolbar: '#wQbdQualityCostHeaderToolsBar'
            ,method: 'post'
            ,autoSort: false //是否排序
            ,cols: [totalCols],done:function () {
                table.resize("wQbdQualityCostTable");
                common.tableSelectCon('.ccpui-enterSel .layui-form input','a[lay-event=query]','.ccpui-enterSel');
            }
            ,parseData: function(res){ //res 即为原始返回的数据
                common.parseDataList(res,['preventionCost','appraisalCosts','internalFailureCost','externalFailureCost']);
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.count, //解析数据长度
                    "data": res.data //解析数据列表
                };
            }
        });
        //list页面初始化展开按钮tips展示（展开按钮类名）
        publicMethods.tipsAuto('.screen')
        //筛选条件初始化（页面表格的Id，是否初始化（true、false））
        common.initScreenTop('wQbdQualityCostTable',true);
        dateReflash()

        //-- 初始化 数据字典 开始 --------------------------------------------------------------
        var xhdhList = eval('${xhdhList}'); //型号代号
        var initXHDH = function(optionObj, item){
            optionObj.text = item.fModelcode;
            optionObj.value = item.id;
        };
        common.initDicData("Q_modelCode_SL", xhdhList, "", initXHDH);


        //-- 初始化 数据字典 结束 --------------------------------------------------------------

        table.on('toolbar(wQbdQualityCostTable)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            var data = checkStatus.data;
            var _this = this;
            switch (obj.event) {
                case 'add':
                    window.location.href = "${ctx}/qbdms/wQbdQualityCost/view/add";
                    break;
                case 'delete':
                    var array = "";
                    for (var i = 0; i < data.length; i++) {
                        array+=data[i].id+",";
                    }
                    delFun(data,array);
                    break;
                case 'export':
                function open(url , param){
                    var curUrl = url;
                    layer.open({
                        type: 2,
                        area: ['700px', '520px'],
                        title: ['自定义导出', 'font-size:14px;'],
                        content: '${ctx}/qbdms/wQbdQualityCost/view/export',
                        btnAlign: 'c',
                        skin: 'qbdms-layerFormBtn',
                        btn: ['确定', '取消'],
                        yes: function(index, layero){
                            url = curUrl;
                            var iframeWin = window["layui-layer-iframe" + index];
                            var data = iframeWin.getData();
                            if(data){
                                url = url + "?data=" + JSON.stringify(data) + param;
                                window.location.href = encodeURI(url)
                            }
                        }
                    });
                }
                    if (data.length == 0) {
                        layer.confirm(publicMethods.confirmStyle('还没有选择，是否导出全部？'),{title: false,skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            var url = '${ctx}/qbdms/wQbdQualityCost/exportData';
                            var param = "";
                            $("form[lay-filter='wQbdQualityCostQueryForm']").find(".filter-value").each(function(i,value) {
                                param += "&"+this.name+"="+this.value
                            });
                            open(url , param);
                        });
                    } else {
                        layer.confirm(publicMethods.confirmStyle('确定导出吗？'),{title: false,skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            var ids = [];
                            for (var i = 0; i < data.length; i++) {
                                ids.push(data[i].id);
                            }
                            var url = '${ctx}/qbdms/wQbdQualityCost/exportData';
                            open(url , "&id="+ids);
                        });
                    }
                    break;
                case "import":
                    common.importInit('wQbdQualityCostTable',"/qbdms/wQbdQualityCost/importData",true,"/importTemplates/质量成本管理.xlsx");
                    dateReflash();
                    break;
                case "screen":
                    common.initScreenTop('wQbdQualityCostTable');
                    dateReflash();
                    form.render();
                    break;
                case "query":
                    reflashQuery(false);
                    dateReflash();
                    break;
                case "clears":
                    reflashQuery(true);
                    dateReflash();
                    break;
                case "report":
                    var array = "";
                    for (var i = 0; i < data.length; i++) {
                        array+=data[i].id+",";
                    }
                    //业务表名,勾选数据主键,流程key,table标签lay-filter属性值,form标签lay-filter属性值,是否允许重复上报,页面所在包名,流程定义id
                    common.report("W_QBD_QUALITY_COST",array,"plantToHospital","wQbdQualityCostTable","wQbdQualityCostQueryForm",false,"wQbdQualityCost","plantToHospital:1:72d05d40362249118c5453aa60c6da90");
                    dateReflash();
                    break;
            };
        });

        function dateReflash() {
            var dateTimeFiledLen = $(".dateTimeFiled");
            var currentDate = new Date();
            var currentYear = currentDate.getFullYear();
            for(var i=0;i<dateTimeFiledLen.length;i++){
                laydate.render({
                    elem: dateTimeFiledLen[i] //指定元素
                    ,type: 'year'
                    ,trigger: 'click'
                });
            }
            publicMethods.reflashDate({startName:'.start_time',endName:'.end_time'});
        }

        function reflashQuery(isClear) {
            common.tableConditionRender("wQbdQualityCostTable","wQbdQualityCostQueryForm",{where:{}},isClear);
            common.initDicData("Q_modelCode_SL", xhdhList, "", initXHDH);
        }

        table.on('tool(wQbdQualityCostTable)', function(obj) {
            var data = obj.data, //获得当前行数据
                    layEvent = obj.event; //获得 lay-event 对应的值
            switch(layEvent){
                case "edit":

                    window.location.href = '${ctx}/qbdms/wQbdQualityCost/view/add?id='+data.id;
                    break;
                case "particulars":

                    window.location.href = '${ctx}/qbdms/wQbdQualityCost/view/particulars?id='+data.id;
                    break;
                case "del":
                    delFun(data,data.id);
                    break;
            }
        });

        function delFun(data,id) {
            if (data.length === 0) {
                layer.alert(publicMethods.confirmStyle('请先选择一行数据!'),{title: false,skin: 'confirm-class'});
            } else {
                layer.confirm(publicMethods.confirmStyle('确定删除当前数据吗?'),{title: false,skin: 'confirm-class'}, function (index) {
                    layer.close(index);
                    $.ajax({
                        url: "${ctx}/qbdms/wQbdQualityCost/del",
                        type: "post",
                        data: {id:id},
                        dataType: 'json',
                        success: function (data) {
                            layer.alert(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'});
                            //执行重载
                            reflashQuery(true);
                            dateReflash();
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            layer.alert(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'});
                            //执行重载
                            reflashQuery(true);
                            dateReflash();
                        }
                    })
                })
            }
        }

        /*刷新时间控件*/
        dateReflash();
        window.Initialization = function () {
            reflashQuery(true);
            dateReflash();
        };

        common.tableSort("wQbdQualityCostTable",{show:dateReflash});
    });
</script>
</body>
</html>